package com.msmall.base;

import javax.servlet.http.HttpServletRequest;

public class PaginationSupportUtil {

	public static PaginationSupport get(HttpServletRequest request){
		PaginationSupport page = new PaginationSupport();
		int pageIndex = 1;
		int pageSize = 15;
		String pageInfo = request.getParameter("pi");
		if(pageInfo != null && pageInfo.length() >0){
			try{
				String[] pi = pageInfo.split("_");
				pageIndex = Integer.valueOf(pi[0]);
				if(pi.length ==2)
					pageSize = Integer.valueOf(pi[1]);
			}catch(Exception e){}
		}
		page.setPageIndex(pageIndex);
		page.setPageSize(pageSize);
		return page;
	}
}
